package com.hdax.dm.controller;

import com.hdax.dm.common.utils.CommonResponse;
import com.hdax.dm.dtos.scheduler.ChooseSeatScheduleDto;
import com.hdax.dm.dtos.scheduler.SeatDto;
import com.hdax.dm.service.ChooseSeatService;
import com.hdax.dm.service.SchedulerSeatService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

@RestController
@RequestMapping(path = "/scheduler")
public class ChooseSeatScheduleController {

    @Autowired
    private ChooseSeatService service;
    @Autowired
    private SchedulerSeatService seatService;

    @PostMapping(path = "choose/seat/getSeatList")
    public CommonResponse<SeatDto> getSeatList(@RequestBody Map<String, Long> params){
        Long scheduleId = params.get("scheduleId");
        return seatService.getSeatArray(scheduleId);
    }

    @PostMapping(path = "choose/seat/getSchedule")
    public CommonResponse<ChooseSeatScheduleDto> getSchedule(@RequestBody Map<String, Long> params){
        Long scheduleId = params.get("scheduleId");
        Long cinemaId = params.get("cinemaId");
        return service.getSchedule(scheduleId,cinemaId);
    }

}
